$(function() { // 页面加载完成后事件
	var flag = true;
	//加载主页
	$("#mainInfobox1").load("jsp/home.jsp");

	$(".mainnav").click(function() {
		var navIndex = $(".mainnav").index(this);
	
		console.info(navIndex);
		if (navIndex == 0)
		{
			$("#mainInfobox1").load("jsp/home.jsp");	
		}else
		{
			var subnav="#subnav_"+navIndex;
			console.info(subnav);
			$(subnav).slideToggle();
		}

	});
	$("#nav_list .subnav_li").click(function() {
		var subnavIndex = $(".subnav_li").index(this);
		
		console.log("subnavIndex------>" + subnavIndex);
		switch (subnavIndex) {

		case (0):
			$("#mainInfobox1").load("jsp/page1.jsp");
			console.log("loading page1 jsp");
			break;
		case (1):
			$("#mainInfobox1").load("jsp/page2.jsp");
			console.log("loading page2 jsp");
			break;
		case (2):
			$("#mainInfobox1").load("jsp/page3.jsp");
			console.log("loading page3 jsp");
			break;

		case (3):
			$("#mainInfobox1").load("jsp/page4.jsp");
			console.log("loading page4 jsp");
			break;

		}
	});

});